import Main from '@/pages/Main.vue';
import {userOtherRouter, userAppRouter} from '../user/route/router';
import {workflowOtherRouter, workflowAppRouter} from '../workflow/route/router';
import {customerOtherRouter, customerAppRouter} from '../customer/route/router';
import {reportOtherRouter, reportAppRouter} from '../report/route/router';
import {financialOtherRouter, financialAppRouter} from '../financial/route/router';
import {mallOtherRouter, mallAppRouter} from '../mall/route/router';
// import {bossOtherRouter, bossAppRouter} from '../boss/route/router';

// import ecRouter from './ec';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['@/pages/login.vue'], resolve); }
};
/*!
 * 余思颖新增引导页路由(2019-04-04)
 * 
 */
export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => { require(['@/pages/error-page/404.vue'], resolve); }
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: resolve => { require(['@//pages/error-page/403.vue'], resolve); }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: resolve => { require(['@/pages/error-page/500.vue'], resolve); }
};
export const preview = {
    path: '/preview',
    name: 'preview',
    component: resolve => { require(['@/pages/form/article-publish/preview.vue'], resolve); }
};
export const guidePage = {
    path: '/guidePage',
    name: 'guidePage',
    title: '引导页',
    component: resolve => { require(['@/pages/guidePage.vue'], resolve); }
};
export const locking = {
    path: '/locking',
    name: 'locking',
    component: resolve => { require(['@/pages/main-components/lockscreen/components/locking-page.vue'], resolve); }
};
// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: '工作台', name: 'home_index', component: resolve => { require(['@/pages/home/home.vue'], resolve); } },
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/pages/selfInfo/selfInfo.vue'], resolve); } },
        { path: '/home/myDesktop', title: '我的桌面', name: 'myDesktop', component: resolve => { require(['@/pages/myDesktop/myDesktop.vue'], resolve); } },
        { path: '/backlogModule/backlogModuleList', title: '待办事项', name: 'backlogModuleList', component: resolve => { require(['@/pages/components/backlogModule/backlogModuleList.vue'], resolve); } },
        { path: '/connection/connectionList', title: '人脉关系', name: 'connectionList', component: resolve => { require(['@/customer/pages/connectionList.vue'], resolve); } },
        { path: '/missionModule/inProcessList', title: '我发起的', name: 'inProcessList', component: resolve => { require(['@/pages/components/missionModule/inProcessList.vue'], resolve); } },
        { path: '/missionModule/waitingList', title: '待我审批', name: 'waitingList', component: resolve => { require(['@/pages/components/missionModule/waitingList.vue'], resolve); } },
        { path: '/missionModule/duplicateList', title: '抄送我的', name: 'duplicateList', component: resolve => { require(['@/pages/components/missionModule/duplicateList.vue'], resolve); } },
        { path: '/message/message', title: '我的消息', name: 'myMessage', component: resolve => { require(['@/pages/message/message.vue'], resolve); } },
        { path: '/createPage',title:'创建商城',name: 'createPage', component: resolve => { require(['@/pages/createPage.vue'], resolve); }},
        { path: '/shopSetting',title:'创建商城',name: 'shopSetting', component: resolve => { require(['@/pages/shopSetting.vue'], resolve); }},
        ...userOtherRouter,
        ...workflowOtherRouter,
        ...customerOtherRouter,
        ...reportOtherRouter,
        ...financialOtherRouter,
        ...mallOtherRouter,
        // ...bossOtherRouter
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/general',
        icon: 'images',
        name: 'general',
        title: '系统管理',
        component: Main,
        access: 1,
        children: [
            { path: 'user', title: '用户管理', name: 'user', component: resolve => { require(['@/pages/general/user.vue'], resolve); } },
            { path: 'Resources', title: '资源管理', name: 'resources', component: resolve => { require(['@/pages/general/Resources.vue'], resolve); } },
            { path: 'Role', title: '角色管理', name: 'role', component: resolve => { require(['@/pages/general/Role.vue'], resolve); } },
            { path: 'Address', title: '地址管理', name: 'address', component: resolve => { require(['@/pages/general/Address.vue'], resolve); } }
        ]
    },
    {
        path: '/system',
        icon: 'images',
        name: 'system',
        title: '系统',
        component: Main,
        access: 1,
        children: [
            { path: 'Jurisdiction', title: '权限', name: 'Jurisdiction', component: resolve => { require(['@/pages/system/Jurisdiction.vue'], resolve); } },
            { path: 'Journal', title: '日志', name: 'Journal', component: resolve => { require(['@/pages/system/Journal.vue'], resolve); } }
        ]
    },
    {
        path: '/messageMage',
        icon: 'images',
        name: 'messageMage',
        title: '消息',
        component: Main,
        access: 1,
        children: [
            { path: 'letter', title: '站内信', name: 'letter', component: resolve => { require(['@/pages/general/orgEditor.vue'], resolve); } },
            { path: 'Opinion', title: '意见反馈', name: 'Opinion', component: resolve => { require(['@/pages/workflow/workDefine.vue'], resolve); } }
        ]
    },
    ...userAppRouter,
    ...workflowAppRouter,
    ...customerAppRouter,
    ...reportAppRouter,
    ...financialAppRouter,
    ...mallAppRouter,
    // ...bossAppRouter
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    guidePage,
    page500,
    page403,
    page404,
];
